unit WebAPI_Thread;

interface

uses
  Classes;

type
  TRunAction = procedure of object;

  TMThread = class(TThread)
  private
    MRun: TRunAction;
  public
    constructor Create(run: TRunAction);
  protected
    procedure Execute; override;
  end;

implementation

{ TMThread }

constructor TMThread.Create(run: TRunAction);
begin
  inherited Create(False);
  MRun := run;
  FreeOnTerminate := true;
end;

procedure TMThread.Execute;
begin
  inherited;
  MRun;
end;

end.

